<template>
  <div id="app">
    <router-view  v-if="isRouterAlive" />
  </div>
</template>

<script>
export default {
  name: 'App',
  provide() {
    return {
      reload: this.reload,
    }
  },
  data() {
    return {
      isRouterAlive: true,
    }
  },
   methods: {
    reload() {
      this.isRouterAlive = false
      this.$nextTick(() => {
        this.isRouterAlive = true
      })
    }
  },
  mounted () {
    // window.onresize = function () {
    // (function (designWidth, minWidth) {
      const docEle = document.documentElement
      const screenRatioByDesign = 16 / 9
      function setHtmlFontSize () {
        var screenRatio = docEle.clientWidth / docEle.clientHeight
        var fontSize =
          ((screenRatio > screenRatioByDesign
            ? screenRatioByDesign / screenRatio
            : 1) *
            docEle.clientWidth) /
          10

        docEle.style.fontSize = fontSize.toFixed(3) + 'px'
      }
      setHtmlFontSize()
      window.addEventListener('resize', setHtmlFontSize)
    // })(1920, 1080)
    // };
  }
}
</script>
